<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ taglib prefix="s" uri="/struts-tags"%>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Fact Entry Tool-Login</title>
    <meta name="author" content="Ifti" />
    <meta name="description" content="Ifti, Ifta Khirul, Fact Entry, Data Entry, CMS" />
    <meta name="keywords" content="Ifti, Ifta Khirul, Fact Entry, Data Entry, CMS" />
    <meta name="application-name" content="Fact Entry Management Tools" />

    <!-- Mobile Specific Metas -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <!-- Le styles -->
    <link href="/FMTOOL_WEB/resources/css/bootstrap/bootstrap.css" rel="stylesheet" />
    <link href="/FMTOOL_WEB/resources/css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
    <link href="/FMTOOL_WEB/resources/css/supr-theme/jquery.ui.supr.css" rel="stylesheet" type="text/css"/>
    <link href="/FMTOOL_WEB/resources/css/icons.css" rel="stylesheet" type="text/css" />
    <link href="/FMTOOL_WEB/resources/plugins/forms/uniform/uniform.default.css" type="text/css" rel="stylesheet" />

    <!-- Main stylesheets -->
    <link href="/FMTOOL_WEB/resources/css/main.css" rel="stylesheet" type="text/css" /> 
    
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="/FMTOOL_WEB/resources/images/favicon.ico" />
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/FMTOOL_WEB/resources/images/apple-touch-icon-144-precomposed.png" />
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/FMTOOL_WEB/resources/images/apple-touch-icon-114-precomposed.png" />
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/FMTOOL_WEB/resources/images/apple-touch-icon-72-precomposed.png" />
    <link rel="apple-touch-icon-precomposed" href="/FMTOOL_WEB/resources/images/apple-touch-icon-57-precomposed.png" />

    </head>
      
    <body class="loginPage">

    <div class="container-fluid">

        <div id="header">

            <div class="row-fluid">

                <div class="navbar">
                    <div class="navbar-inner">
                      <div class="container">
                            <a class="brand" href="dashboard.html">Fact.<span class="slogan">entry</span></a>
                      </div>
                    </div><!-- /navbar-inner -->
                  </div><!-- /navbar -->
                

            </div><!-- End .row-fluid -->

        </div><!-- End #header -->

    </div><!-- End .container-fluid -->    

    <div class="container-fluid">

        <div class="loginContainer">
            <form class="form-horizontal" action="dashboard.html" id="loginForm" >
                <div class="form-row row-fluid">
                    <div class="span12">
                        <div class="row-fluid" id="userNameDiv">
                            <label class="form-label span12" for="username">
                                Username:
                                <span class="icon16 icomoon-icon-user-3 right gray marginR10"></span>
								<div id="loadingDiv" style="float:right;"></div>
                            </label>
                            <input class="span12" id="username" type="text" name="username" value="" tabindex="1"/>
                        </div>
                    </div>
                </div>

                <div class="form-row row-fluid">
                    <div class="span12">
                        <div class="row-fluid">
                            <label class="form-label span12" for="password">
                                Password:
                                <span class="icon16 icomoon-icon-locked right gray marginR10"></span>
                                <span class="forgot"><a href="#">Forgot your password?</a></span>
                            </label>
                            <input class="span12" id="password" type="password" name="password" value="" tabindex="2" />
                        </div>
                    </div>
                </div>
                <div class="form-row row-fluid">                       
                    <div class="span12">
                        <div class="row-fluid">
                            <div class="form-actions">
                            <div class="span12 controls">
                                <!-- 
                                <input type="checkbox" id="keepLoged" value="Value" class="styled" name="logged" /> Keep me logged in
                                 -->
                                <button type="submit" class="btn btn-info right" id="loginBtn" tabindex="3"><span class="icon16 icomoon-icon-enter white"></span> Login</button>
                            </div>
                            </div>
                        </div>
                    </div> 
                </div>

            </form>
        </div>

    </div><!-- End .container-fluid -->

    <!-- Le javascript
    ================================================== -->
    <script  type="text/javascript" src="/FMTOOL_WEB/resources/thirdParty/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="/FMTOOL_WEB/resources/js/bootstrap/bootstrap.js"></script>  
    <script type="text/javascript" src="/FMTOOL_WEB/resources/plugins/fix/touch-punch/jquery.ui.touch-punch.min.js"></script>
    <script type="text/javascript" src="/FMTOOL_WEB/resources/plugins/fix/ios-fix/ios-orientationchange-fix.js"></script>
    <script type="text/javascript" src="/FMTOOL_WEB/resources/plugins/forms/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="/FMTOOL_WEB/resources/plugins/forms/uniform/jquery.uniform.min.js"></script>

     <script type="text/javascript">
        // document ready function
        $(document).ready(function() {
            $("input, textarea, select").not('.nostyle').uniform();
            $("#loginForm").validate({
                rules: {
                    username: {
                        required: true,
                        minlength: 4
                    },
                    password: {
                        required: true,
                        minlength: 4
                    }  
                },
                messages: {
                    username: {
                        required: "User Name required.",
                        minlength: "User Name is at least 4 chars long"
                    },
                    password: {
                        required: "Please provide a password",
                        minlength: "Password is at least 4 chars long"
                    }
                },
                
                submitHandler: function(form) {
			          $("#loadingDiv").html("<img src='/FMTOOL_WEB/resources/images/loaders/circular/011.gif' border='0' />");
			  		  var x= $.ajax({
    		  		  url: "checkValidity.action",
			  		  type: 'POST',
		      		  async: false,
			  		  data: "userId=" + $("#username").val() + "&password="+$("#password").val()
			  		  }).responseText;
				
					  if(x.indexOf("success")>=0)
					    window.location="dashBoard.action";
					  else
						{
						 $("#userNameDiv").append("<label class='error' for='username' generated='true'>Invalid Username or Password</label>");
						 $("#loadingDiv").html("");
						}
        	 	}  //End of Submit Handler   
            });
         });
        
        $("form").submit(function(e){
			e.preventDefault()
		})
    </script>
 
    </body>
</html>
